<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateMaterialUnitsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('material_units', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('mechanism_id')->default(0)->comment('机构 id');
            $table->unsignedInteger('book_id')->default(0)->comment('教材 id');
            $table->unsignedInteger('keyword_one_id')->default(0)->comment('词汇 1');
            $table->unsignedInteger('keyword_two_id')->default(0)->comment('词汇 2');
            $table->unsignedInteger('paint_id')->default(0)->comment('绘本');
            $table->unsignedInteger('natural_spelling_id')->default(0)->comment('自然拼读');
            $table->unsignedInteger('video_id')->default(0)->comment('视频');
            $table->unsignedInteger('music_id')->default(0)->comment('歌曲');
            $table->unsignedInteger('test_id')->default(0)->comment('测试');
        });
        DB::statement("ALTER TABLE `material_units` comment '教材单元表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('material_units');
    }
}
